/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controladores;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import modelo.Cliente;
import modelo.DAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 * @author Administrador
 */
@Controller
public class Home {
    
    @Autowired
    private DAO dao;
    
    @RequestMapping(value="/home.htm")
    public String ejecutar(HttpServletRequest request,ModelMap modelo){
        
        List<Cliente> clientes = dao.buscarTodosClientes();
        
        request.setAttribute("clientes",clientes);
        
        modelo.addAttribute("clientes",clientes);

        return "home";
    }
}
